package com.jv.spring.importaware.define;

import org.springframework.context.annotation.ImportAware;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;

import java.util.Map;

public class MyImportAware implements ImportAware {
	private String nameAA;

	private String nameBB;

	@Override
	public void setImportMetadata(AnnotationMetadata importMetadata) {
		Map<String, Object> map = importMetadata.getAnnotationAttributes(MyImport.class.getName());
		AnnotationAttributes attrs = AnnotationAttributes.fromMap(map);
		this.nameAA = attrs.getString("nameAA");
		this.nameBB = attrs.getString("nameBB");
		System.out.println("nameAA:"+this.nameAA);
		System.out.println("nameBB:"+this.nameBB);
	}
}
